package com.guigu.qingcheng.service;

import com.guigu.qingcheng.pojo.TbOrderItem;
import com.guigu.qingcheng.utils.R;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;
import java.util.Map;

/**
 * 远程调用goods
 */
@FeignClient("service-goods")
@Component
public interface GoodsServiceFeign {

    /**
     *根据分类获取品牌
     * @param name
     * @return
     */
    @PostMapping("/goods/brand/queryByCategoryName")
    public R queryByCategoryName(@RequestParam String name);

    /**
     * 根据分类获取spec参数
     * @param name
     * @return
     */
    @PostMapping("/goods/spec/queryListByCategoryName")
    public R queryListByCategoryName(@RequestParam String name);

    @GetMapping("/goods/sku/detail/{id}")
    public R detail(@PathVariable("id") String id);

    @GetMapping("/goods/category/detail/{id}")
    public R detailcategory(@PathVariable("id") Integer id);

    // 扣减库存
    @PostMapping("/goods/sku/deductionStock")
    public boolean deductionStock(@RequestParam List<TbOrderItem> list);

    /**
     * 查询category
     * @return
     */
    @GetMapping("/goods/category/list")
    public R list();

    @GetMapping("/goods/category/findCategoryTree")
    public R findTree();

    @GetMapping("/goods/tempaltes/createPage/{id}")
    public R createPage(@RequestParam String id);

    @GetMapping("/goods/category/detailname/{id}")
    public R detailname(@RequestParam Integer id);

    /**
     * 查询销量最高的四件商品
     * @return
     */
    @GetMapping("/goods/sku/findSkuBySaleNum")
    R findSkuBySaleNum();
    @GetMapping("/goods/category/detail/{id}")
    public R detail(@RequestParam Integer id);

    @GetMapping("/goods/sku/price/{id}")
    public Integer price(@RequestParam String id);

    //首页今日推荐
    @GetMapping("/goods/category/today")
    public R Today();
}
